const getDateTree = () => {
	let today = new Date();
	let year = today.getFullYear();
	let month = today.getMonth() + 1;
	const dataTree = []
	const children = [];
	const lastChildren = [];
	for (let i = 1; i <= 12; i++) {
		let tmp = {
			text: i + "月",
			value: (i < 10 ? "0" : "") + i
		}
		children.push(tmp);
		if (i <= month) {
			lastChildren.push(tmp);
		}
	}

	for (let start = 2015; start < year; start++) {
		let tmp = children.map(item => {
			return {
				text: item.text,
				value: start + "-" + item.value
			}
		})
		dataTree.push({
			text: start + "年",
			value: start,
			children: tmp,
		})
	}
	lastChildren.forEach(item => {
		item.value = year + "-" + item.value
	})
	dataTree.push({
		text: year + "年",
		value: year,
		children: lastChildren
	});

	return dataTree;
}

export default getDateTree;